cpp
#include <iostream>
#include <fstream>
#include <vector>
#include <chrono>

void bubble_sort(std::vector<int>& arr) {
    int n = arr.size();
    bool swapped;
    for (int i = 0; i < n - 1; ++i) {
        swapped = false;
        for (int j = 0; j < n - i - 1; ++j) {
            if (arr[j] > arr[j + 1]) {
                std::swap(arr[j], arr[j + 1]);
                swapped = true;
            }
        }
        if (!swapped) {
            break;
        }
    }
}

void sort_file(const std::string& filename) {
    std::ifstream inputFile(filename);
    if (!inputFile.is_open()) {
        std::cerr << "Failed to open file for reading." << std::endl;
        return;
    }

    std::vector<int> values;
    int num;
    while (inputFile >> num) {
        values.push_back(num);
    }

    auto start = std::chrono::high_resolution_clock::now();
    bubble_sort(values);
    auto end = std::chrono::high_resolution_clock::now();
    auto elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end - start);

    std::cout << "Sorting time: " << elapsed.count() << " milliseconds" << std::endl;
}

int main() {
    sort_file("input.txt")
